<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1251" />
    <title>Open API sample page</title>
    <base href="http://vkontakte.ru/" target="_blank" />
    <!--[if lte IE 6]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(http://vkontakte.ru/css/ie.css); /* ]]> */</style><![endif]-->

    <!--[if IE 7]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(http://vkontakte.ru/css/ie7.css); /* ]]> */</style><![endif]-->
    <!--[if gte IE 8]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(http://vkontakte.ru/css/ie8.css); /* ]]> */</style><![endif]-->
    <script src="http://vkontakte.ru/js/common.js"></script>
    <script src="openapi/openapi_sample.js"></script>
  </head>
  <body>
    <div id="vk_api_transport"></div>

    <script type="text/javascript">
      window.vkAsyncInit = function() {
        VK.Observer.subscribe('auth.login', function(response) {
          window.location = baseURL + '/openapi/getdata.php';
        });
        VK.Observer.subscribe('auth.logout', function() {
          window.location = baseURL + '/openapi/';
          //console.log('logout');
        });
        VK.Observer.subscribe('auth.statusChange', function(response) {
          //console.log('statusChange');
        });
        VK.Observer.subscribe('auth.sessionChange', function(r) {
          //console.log('sessionChange');
        });
        VK.init({
          apiId: 2117003,
          nameTransportPath: '/openapi/xd_receiver.html'
        });
        VK.UI.button('vk_login');
      };
      (function() {
        var el = document.createElement('script');
        el.type = 'text/javascript';
        el.src = 'http://vkontakte.ru/js/api/openapi.js';
        el.async = true;
        document.getElementById('vk_api_transport').appendChild(el);
      }());
    </script>

    <div id="openapi_login_wrap">
      <div id="vk_login" style="margin: 0 auto 20px auto;" onclick="doLogin();"></div>
    </div>
  </body>
</html>